﻿CREATE PROCEDURE [ServiceEngine].[ListOperationVersionsBySchemaObject]
@SchemaObjectID UNIQUEIDENTIFIER
AS
BEGIN
	SET NOCOUNT ON;

	SELECT	DISTINCT OV.OperationVersionID as ID, N.EntityName , OV.VersionMajor, OV.VersionMinor, OV.VersionBuild, OV.VersionQFE
	FROM	[ServiceEngine].OperationVersions OV
	JOIN	[ServiceEngine].MessageParts MP on OV.OperationVersionID = MP.OperationVersionID
	JOIN	[ServiceEngine].[Names] N on N.EntityID = OV.OperationID
	JOIN	[ServiceEngine].SchemaObjects SO on SO.SchemaObjectID = MP.SchemaObjectID
	WHERE	SO.SchemaObjectID = @SchemaObjectID 
END

